﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace WorkStation.Frameworks.Core.Data.DataTableValidate.Rules
{
    /// <summary>
    /// * 数据表是否含有数据验证
    /// </summary>
    public class EmptyDataTableRule : TableRuleBase
    {
        public override ValidateResult Execute(DataTable table)
        {
            ValidateResult res = new ValidateResult() { IsSuccess = true };

            if (table.Rows == null || table.Rows.Count == 0) 
            {
                res.IsSuccess = false;
                res.Msg = "数据表中没有数据";
            }

            return res;
        }
    }
}
